package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateDeviceInfoGetPageDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateHardwareDeviceUpdateDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateHardwareProjectGetPageDTO;
import com.itlong.cloud.POJO.VO.operate.OperateDeviceInfoVO;
import com.itlong.cloud.POJO.VO.operate.OperateProjectInfoVO;
import com.itlong.cloud.POJO.VO.operate.OperateUpdateInfoVO;
import com.itlong.cloud.POJO.VO.property.PropertyProjectUnitInfoVO;
import com.itlong.cloud.equip.operate.IOperateHardwareServiceClient;
import com.itlong.cloud.operate.service.IOperateHardwareService;
import com.itlong.cloud.utils.page.Page;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <desc>
 *     运营-固件升级-设备升级露接口实现类。
 * <desc/>
 *
 * @createDate 2018/08/27.
 */
@RestController
public class OperateHardwareServiceResource implements IOperateHardwareServiceClient {

    private static final Logger LOG = LoggerFactory.getLogger(OperateHardwareServiceResource.class);

    @Autowired
    IOperateHardwareService iOperateHardwareService;

    /**
     * <desc>
     *      分页获取安装包信息。
     * <desc/>
     *
     * @param  operateUpdateInfoGetPageDTO 参数请求对象
     * @return
     * @author Qiang.S
     * @createDate 2018/08/27
     */
    @Override
    @RequestMapping(path = "/operate/upgrade/hardware/getDeviceInfoPage",method = RequestMethod.POST)
    public Page<OperateDeviceInfoVO> getDeviceInfoPage(@RequestBody OperateDeviceInfoGetPageDTO operateUpdateInfoGetPageDTO) throws Exception{
        return iOperateHardwareService.getDeviceInfoPage(operateUpdateInfoGetPageDTO);
    }

    /**
     * <desc>
     *      根据项目编号获取设备更新时间
     * <desc/>
     *
     * @param projectId 项目编号
     * @return
     * @author Qiang.S
     * @createDate 2018-09-04
     */
    @Override
    @RequestMapping(path = "/operate/upgrade/hardware/getUpgradeTimeByProjectId",method = RequestMethod.POST)
    public String getUpgradeTimeByProjectId(@RequestParam("projectId")String projectId) throws Exception{
        return iOperateHardwareService.getUpgradeTimeByProjectId(projectId);
    }

    /**
     * <desc>
     *      按条件分页获取项目列表
     * <desc/>
     *
     * @param operateHardwareProjectGetPageDTO 查询参数DTO
     * @return
     * @author Qiang.S
     * @createDate 2018-08-28
     */
    @Override
    @RequestMapping(path = "/operate/upgrade/hardware/getProjectInfoPage",method = RequestMethod.POST)
    public Page<OperateProjectInfoVO> getProjectInfoPage(@RequestBody OperateHardwareProjectGetPageDTO operateHardwareProjectGetPageDTO) throws Exception{
        return iOperateHardwareService.getProjectInfoPage(operateHardwareProjectGetPageDTO);
    }

    /**
     * <desc>
     *      按条件分页获取项目列表
     * <desc/>
     *
     * @param projectId 项目编号
     * @return
     * @author Qiang.S
     * @createDate 2018-08-28
     */
    @Override
    @RequestMapping(path = "/operate/upgrade/hardware/getBuildInfo",method = RequestMethod.POST)
    public List<PropertyProjectUnitInfoVO> getBuildInfo(@RequestParam("projectId") String projectId) throws Exception{
        return iOperateHardwareService.getBuildInfo(projectId);
    }

    /**
     * <desc>
     *      获取项目单元信息
     * <desc/>
     *
     * @param projectId 项目编号
     * @param buildId 楼栋编号
     * @return
     * @author Qiang.S
     * @createDate 2018-08-28
     */
    @Override
    @RequestMapping(path = "/operate/upgrade/hardware/getUnitInfo",method = RequestMethod.POST)
    public List<PropertyProjectUnitInfoVO> getUnitInfo(@RequestParam("projectId") String projectId, @RequestParam("buildId") String buildId) throws Exception{
        return iOperateHardwareService.getUnitInfo(projectId,buildId);
    }

    /**
     * <desc>
     *      设置项目设备更新时间
     * <desc/>
     *
     * @param projectId 项目编号
     * @param upgradeTime 项目设备升级时间
     * @return
     * @author Qiang.S
     * @createDate 2018-08-28
     */
    @Override
    @RequestMapping(path = "/operate/upgrade/hardware/setupUpdateTime",method = RequestMethod.POST)
    public Integer setupUpdateTime(@RequestParam("projectId") String projectId,@RequestParam("upgradeTime") String upgradeTime) throws Exception{
        return iOperateHardwareService.setupUpdateTime(projectId,upgradeTime);
    }

    /**
     * <desc>
     *      设备更新
     * <desc/>
     *
     * @param operateHardwareDeviceUpdateDTO 设备更新信息
     * @return
     * @author Qiang.S
     * @createDate 2018-08-28
     */
    @Override
    @RequestMapping(path = "/operate/upgrade/hardware/deviceUpdate",method = RequestMethod.POST)
    public Integer deviceUpdate(@RequestBody OperateHardwareDeviceUpdateDTO operateHardwareDeviceUpdateDTO) throws Exception{
        return iOperateHardwareService.deviceUpdate(operateHardwareDeviceUpdateDTO);
    }

    /**
     *<desc>
     * 通过设备类型查询安装包
     *</desc>
     *
     * @Author  chengshican
     * @Date   2020-11-12 10:37
     * @Param
     * @Return
     * @Exception
     *
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getPackageNameByProductType" ,method = RequestMethod.POST)
    @Override
    public List<OperateUpdateInfoVO> getPackageNameByProductType(String productTypes,String deviceType) throws Exception {
        return iOperateHardwareService.getPackageNameByProductType(productTypes, deviceType);
    }

    /**
     * <desc>
     * 通过设备唯一标识符获取云对讲详细信息接口
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2020-11-16 14:39
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getTalkeDetailByDeviceUnique" ,method = RequestMethod.POST)
    @Override
    public OperateDeviceInfoVO getTalkeDetailByDeviceUnique(String deviceUnique) throws Exception {
        return iOperateHardwareService.getTalkeDetailByDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 通过设备唯一标识符获取云电梯详细信息接口
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2020-11-16 14:39
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getElevatorDetailByDeviceUnique" ,method = RequestMethod.POST)
    @Override
    public OperateDeviceInfoVO getElevatorDetailByDeviceUnique(String deviceUnique) throws Exception {
        return iOperateHardwareService.getElevatorDetailByDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 通过设备唯一标识符获取云门禁详细信息接口
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2020-11-16 14:39
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getEntranceDetailByDeviceUnique" ,method = RequestMethod.POST)
    @Override
    public OperateDeviceInfoVO getEntranceDetailByDeviceUnique(String deviceUnique) throws Exception {
        return iOperateHardwareService.getEntranceDetailByDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 通过设备唯一标识符获取群控器详细信息接口
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2020-11-16 14:40
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getClusterDetailByDeviceUnique" ,method = RequestMethod.POST)
    @Override
    public OperateDeviceInfoVO getClusterDetailByDeviceUnique(String deviceUnique) throws Exception {
        return iOperateHardwareService.getClusterDetailByDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 通过设备唯一标识符获取联动器详细信息接口
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2020-11-16 14:40
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getWippenDetailByDeviceUnique" ,method = RequestMethod.POST)
    @Override
    public OperateDeviceInfoVO getWippenDetailByDeviceUnique(String deviceUnique) throws Exception {
        return iOperateHardwareService.getWippenDetailByDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 通过设备唯一标识符获取一体式门禁详细信息接口
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2020-11-16 14:40
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getUnibodyDetailByDeviceUnique" ,method = RequestMethod.POST)
    @Override
    public OperateDeviceInfoVO getUnibodyDetailByDeviceUnique(String deviceUnique) throws Exception {
        return iOperateHardwareService.getUnibodyDetailByDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 通过设备唯一标识符获取平板详细信息接口
     * </desc>
     *
     * @param deviceUnique
     * @Author chengshican
     * @Date 2020-11-16 14:40
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getPadDetailByDeviceUnique" ,method = RequestMethod.POST)
    @Override
    public OperateDeviceInfoVO getPadDetailByDeviceUnique(String deviceUnique) throws Exception {
        return iOperateHardwareService.getPadDetailByDeviceUnique(deviceUnique);
    }

    /**
     * <desc>
     * 获取受限设备云电梯
     * </desc>
     *
     * @Author chengshican
     * @Date 2020-12-07 10:14
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getSpElevatorList" ,method = RequestMethod.POST)
    @Override
    public List<String> getSpElevatorList() throws Exception {
        return iOperateHardwareService.getSpElevatorList();
    }

    /**
     * <desc>
     * 受限设备云群控
     * </desc>
     *
     * @Author chengshican
     * @Date 2020-12-07 10:16
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getSpControllerList" ,method = RequestMethod.POST)
    @Override
    public List<String> getSpControllerList() throws Exception {
        return iOperateHardwareService.getSpControllerList();
    }

    /**
     * <desc>
     *
     * @Description </desc>
     * @Author chengshican
     * @Date 2020-12-07 10:17
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getSpPadList" ,method = RequestMethod.POST)
    @Override
    public List<String> getSpPadList() throws Exception {
        return iOperateHardwareService.getSpPadList();
    }

    /**
     * <desc>
     * 受限设备云门禁
     * </desc>
     *
     * @Author chengshican
     * @Date 2020-12-07 10:18
     * @Param
     * @Return
     * @Exception
     */
    @RequestMapping(path = "/operate/upgrade/hardware/getSpEntranceList" ,method = RequestMethod.POST)
    @Override
    public List<String> getSpEntranceList() throws Exception {
        return iOperateHardwareService.getSpEntranceList();
    }

}
